import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '../views/Layout/index.vue'
//布局子组件引入
import Home from '../views/Home/index.vue'
import Goods from '../views/Goods/index.vue'
// Params子组件引入
import Params from '../views/Params/index.vue'
const Specifications = ()=>import('../views/Params/ParamsInfo/Specifications.vue')

import Advert from '../views/Advert/index.vue'
import Order from '../views/Order/index.vue'

// Order的子组件
import OrderList from '../views/Order/OrderList/index.vue'
import OrderBack from '../views/Order/OrderBack/index.vue'

// 注册组件引入
import Register from '../views/Register/index.vue'
//登录组件引入
import Login from '../views/Login/index.vue'

//User组件引入
const User = ()=>import('../views/User/index.vue')
//Pdf组件引入
const Pdf = ()=>import('../views/Pdf/index.vue')
Vue.use(VueRouter)


const routes = [
  {
    path: '',
    component: Layout,
    meta: {
      isLogin: true
    },
    children: [
      {
        path: '/',
        name: 'Home',
        component: Home
      },
      {
        path: '/goods',
        name: 'Goods',
        component: Goods
      },
      {
        path: '/params',
        name: 'Params',
        component: Params,
        redirect:'/params/specifications',
        children:[
          {
            path:'specifications',
            name:'Specifications',
            component:Specifications
          }
        ]
      },
      {
        path: '/advert',
        name: 'Advert',
        component: Advert
      },
      {
        path: '/user',
        name: 'User',
        component: User
      },
      {
        path: '/pdf',
        name: 'Pdf',
        component: Pdf
      },
      {
        path: '/order',
        name: 'Order',
        component: Order,
        redirect: '/order/orderlist',
        children: [
          {
            path: 'orderlist',
            component: OrderList
          },
          {
            path: 'orderback',
            component: OrderBack
          }
        ]
      },
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/register',
    name: 'Register',
    component: Register
  },
]

const router = new VueRouter({
  routes
})

export default router 
